// ActionScript file
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;


/**
 * 发送HTTPService 
 * @param String url
 * @param Object param
 * @param Function Callback
 * 
 */
public function SendHttpService( url:String, param:Object = null, Callback:Function = null, name:String='' ):void
{
	var httpServiceObj:HTTPService = new HTTPService();
	httpServiceObj.resultFormat = "e4x";
	httpServiceObj.method = "POST";
	httpServiceObj.url = url;
	httpServiceObj.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void{doFault(event,name)} );
	httpServiceObj.addEventListener(ResultEvent.RESULT, Callback );
	httpServiceObj.send(param);
}

/**
 *  do fault for HTTPService
 */
private function doFault(event:FaultEvent, name:String):void{
	trace(name+' is Fault.');
	trace(event.message);
	Alert.show(event.message.toString());
	//event.target.sent();
	//this.process1.label = name+'加载失败。 '+this.countForLoad;
}


//删除我的照片
public function DelMyPhotoRPCResult(e:ResultEvent):void{
	trace('删除照片成功');
	//trace(e.result);
	var data:XML = XML(e.result);
	var d1:String = data.info.result;
	if(d1 == 'success'){
		
	}else if(d1 == 'failure'){
		Alert.show('系统忙，请稍后再试。');
		return;
	}
	//this.SendHttpService(this.url_MyPhotoRPC, null,this.getMyPhotoRPCResult, '读取照片');
}




